<template>
    <div>

        <div v-if="this.id==1">
            <p v-for="(cate, index) in catelist" :key="index">
                申请人：{{cate.staff[0]}}<br>
                请假原因：{{cate.cause[0]}}<br>
                开始时间：{{cate.start_time[0]}}<br>
                结束时间：{{cate.end_time[0]}}<br>
                审批人：{{cate.approver[0]}}
            </p>
        </div>

        <div v-if="this.id==3">
            <p v-for="(cate, index) in catelist" :key="index">
                申请人：{{cate.staff[0]}}<br>
                采购原因：{{cate.cause[0]}}<br>
                采购价格：{{cate.price[0]}}<br>
                审批人：{{cate.approver[0]}}
            </p>
        </div>

    </div>
</template>

<script>
export default {
    data() {
        return {
            id:this.$route.query.id,
            catelist:[]
        }
    },

    mounted:function(){
        var pid = ''
        if(this.id==1){
            pid = 2
        }
        if(this.id==3){
            pid = 3
        }
        this.axios.get("http://localhost:8000/getcatedetail/",{params:{'pid':pid}}).then(res=>{
            console.log(res.data)
            this.catelist = res.data
        })
    }
}
</script>

<style>

</style>